package org.biodas.jdas.dassources.utils;


public enum DasSpec {

	SPEC1_53E("DAS/1.53E"), SPEC1_6E("DAS/1.6E"),SPEC1_53("DAS/1.53"), SPEC1_6("DAS/1.6");
	private String name;
	
	private DasSpec(String name){
		this.name=name;
	}
	/**
	 * Registry only has two catagories for the DAS specification for validation purposes
	 * @param spec
	 * @return
	 */
	public static DasSpec convertToRegistrySpecification(String spec) {
		DasSpec convertedSpec = SPEC1_53E;
		if (spec.contains("6")) {
			convertedSpec = DasSpec.SPEC1_6E;
		}

		return convertedSpec;
	}
	/**
	 * use this method to get fine grained access i.e if we have a DAS/1.53 data source and not DAS/1.53E
	 * @param spec
	 * @return
	 */
	public static DasSpec toDasSpec(String spec) {
		DasSpec defaultSpec = SPEC1_53E;
		for(DasSpec dasSpec:DasSpec.values()){
			if(dasSpec.toString().equals(spec)){
				return dasSpec;
			}
		}
		return defaultSpec;
	}

	public String toString(){
		return name;
	}

}
